//
//  MacroHeader.h
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/3/16.
//  Copyright © 2020 DingC. All rights reserved.
//

#ifndef MacroHeader_h
#define MacroHeader_h

//App名字
#define kAppName @"婺城企服通"


//打印日志
#define DLog(format, ...) NSLog(format,##__VA_ARGS__)

//获取屏幕宽高
#define kTabBarHeight                   (kDevice_Is_iPhoneX ? 83 : 49)
#define kStatusBarHeight                ([[UIApplication sharedApplication] statusBarFrame].size.height)
#define kNavgationBarHeight             (44 + kStatusBarHeight)
#define kScreenWidth                    ([[UIScreen mainScreen]bounds].size.width)
#define kScreenHeight                   ([[UIScreen mainScreen]bounds].size.height)
#define kScreenBounds                   [UIScreen mainScreen].bounds
//颜色 字体
#define RGBColor(Hex)                   [UIColor colorWithHexString:(Hex)]
//首页头部banner宽高比
#define kHomeHeaderProportion              160 / 375
#define kHomeHeaderImageProportion         163 / 251//image高占header的比
//个人中心头部视图宽高比
#define kMineHeaderViewProportion          128 / 375

//iPhone X底部距离
#define kiPhoneXSafeAreaBottomMagin    \
({CGFloat bottomMagin = 0;\
if (@available(iOS 11.0, *)) {\
bottomMagin = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;\
}\
(bottomMagin);})

//是否是iPhoneX系列
#define kDevice_Is_iPhoneX  \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

//根据ip6的屏幕来拉伸
#define kRealValue(with)                ((with)*(kScreenWidth/375.0f))

//用户登录状态
#define kUserLogin [[NSUserDefaults standardUserDefaults] boolForKey:kLoginStateKey]
#define kLoginStateKey @"LoginStateKey"
#define kLastUserPhone @"LastUser"

//强弱引用
#define WeakSelf(weakSelf)                __weak __typeof(&*self) weakSelf = self
#define StrongSelf(strongSelf)           __strong __typeof(&*self) strongSelf = weakSelf

#define weakify(o) autoreleasepool{} __weak typeof(o) o##Weak = o;
#define strongify(o) autoreleasepool{} __strong typeof(o) o = o##Weak;

//距离范围
#define kRange 2000
//获取系统对象
#define QSAppKeyWindow [UIApplication sharedApplication].keyWindow
//空值转空字符串
#define QSNoNilString(s) (s.length ? s : @"")

//获取当前用户
#define kCurrentUser [QSUserManager sharedQSUserManager].user
#define QSUserDefaults [NSUserDefaults standardUserDefaults]

//获取当前版本号（字符）
#define kCurrentVersion [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]

#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

//跳转appstore
#define QSOpenURL(urlString) {\
    if (@available(iOS 10.0, *)) {\
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:(urlString)] options:@{} completionHandler:nil];\
    } else {\
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:(urlString)]];\
    }\
}\


//分享
#define kShareAppURL @"https://apps.apple.com/cn/app/%E5%A9%BA%E5%9F%8E%E4%BC%81%E6%9C%8D%E9%80%9A/id1514052820"
#define kUMAppKey @"5ec5ff210cafb239f200004b"
//微信
#define kWeChatAppKey @""
#define kWechatAppSecret @""
//QQ
#define kQQAppKey @"1110532610"
#define kQQAppSecret @"QCWvMy8mXlXCuSly"
//微博
#define kWeiBoAppKey @"2047356552"
#define kWeiBoAppSecret @"266dbcc63c8bd1d686e39204b4c4493a"


#endif /* MacroHeader_h */
